<template>
  <div class="result-container">
    <NavHeader :title="$route.meta.title"/>
    <div v-if="isSuccess" class="result-box">
      <img
        class="img-result"
        :src="require('../assets/result/icon_success.png')"
        alt=""
      />
      <div class="result-title title-success">兑换成功</div>
      <div class="result-desc">可以前往湘疆商城查看和消费积分啦！</div>
    </div>
    <div v-else class="result-box">
      <img
        class="img-result"
        :src="require('../assets/result/icon_failed.png')"
        alt=""
      />
      <div class="result-title title-failed">呀，服务器开小差啦～</div>
      <div class="result-desc">麻烦小主再兑换一次吧～</div>
    </div>
    <div class="btn-back" @click="goBack">返回</div>
  </div>
</template>

<script>
import NavHeader from '../components/NavHeader.vue'
export default {
  components:{
    NavHeader
  },
  data() {
    return {
      isSuccess: false,
    };
  },
  created() {
    // 0 为失败   1 为成功
    this.isSuccess = this.$route.query.isSuccess == 1;
  },
  methods: {
    goBack() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="scss" scoped>
.result-container {
  width: 100%;
  min-height: 100%;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  .result-box {
    margin-top: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    .img-result {
      width: 67px;
      height: 67px;
    }
    .result-title {
      margin-top: 20px;
    }
    .title-success {
      font-size: 17px;
      color: #7cc133;
    }
    .title-failed {
      font-size: 17px;
      color: #000;
    }
    .result-desc {
      margin-top: 10px;
      font-size: 12px;
      color: #999;
    }
  }
  .btn-back {
    margin-top: 40px;
    width: 84px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    color: #999;
    font-size: 12px;
    border-radius: 15px;
    border: 1px solid #999;
  }
}
</style>